<template>
  <div>
    <van-datetime-picker
      v-model="currentDate"
      type="date"
      title="选择年月日"
      :min-date="minDate"
      :max-date="maxDate"
      @cancel="$emit('close')"
      @confirm="onconfirm"
    />
  </div>
</template>
           
<script>
import {editUserprofile_api} from "@/api/article/index";
import moment from 'moment'
export default {
  data() {
    return {
      minDate: new Date(1970, 0, 1),
      maxDate: new Date(),
      currentDate: new Date()
    };
  },
  methods:{
  async  onconfirm() {
        const {data:res}=await editUserprofile_api({
          birthday:moment(this.currentDate).format( 'YYYY-MM-DD')
        })
        // console.log(res,'yyyy');
        this.currentDate=res.data.birthday
        this.$emit('birthFunc',res.data.birthday)
    }
  }
};
</script>
<style scoped>
</style>